import VueRouter from 'vue-router'
import Layout from '../layout/Layout.vue'

export const permissionRoutes = [
    {
        path: "/user",
        component: Layout,
        redirect: '/user/index',
        name: "/user",
        meta: {
            icon: 'el-icon-location',
            title: '用户模块'
        },
        children: [
            {
                path: "index",
                name: "/user/index",
                component: () => import('../views/User/index.vue'),
                redirect: '/user/index/list',
                meta: {
                    icon: 'el-icon-location',
                    title: '用户首页'
                },
                children: [
                    {
                        path: "list",
                        name: "/user/index/list",
                        component: () => import('../views/User/list.vue'),
                        meta: {
                            icon: 'el-icon-location',
                            title: '用户列表'
                        },
                    },
                    {
                        path: "add",
                        name: "/user/index/add",
                        component: () => import('../views/User/add.vue'),
                        meta: {
                            icon: 'el-icon-location',
                            title: '添加用户'
                        },
                    },
                    {
                        path: "update",
                        name: "/user/index/update",
                        component: () => import('../views/User/update.vue'),
                        meta: {
                            icon: 'el-icon-location',
                            title: '更新用户'
                        },
                    }
                ]
            }
        ]
    },
    {
        path: "/role",
        name: "/role",
        component: Layout,
        redirect: '/role/index',
        meta: {
            icon: 'el-icon-location',
            title: '角色管理'
        },
        children: [
            {
                path: "index",
                name: "/role/index",
                component: () => import('../views/Role/index.vue'),
                meta: {
                    icon: 'el-icon-location',
                    title: '角色首页'
                },
            },
        ]
    },
    {
        path: "/permission",
        name: "/permission",
        component: Layout,
        redirect: '/permission/index',
        meta: {
            icon: 'el-icon-location',
            title: '权限管理'
        },
        children: [
            {
                path: "index",
                name: "/permission/index",
                component: () => import('../views/Permission/index.vue'),
                meta: {
                    icon: 'el-icon-location',
                    title: '权限首页'
                },
            }
        ]
    }
]

export const routes = [
    {
        path: "/",
        name: "/",
        component: () => import('../views/login/index.vue'),
    }
    ,
    // {
    //     path: "/One",
    //     component: One,
    // },
    ...permissionRoutes

]

const router = new VueRouter({
    routes,
})

export default router